﻿<script type="text/javascript">
  var timerId = null;
  var długośćTekstu;
  var odstęp = 20;
  var tabPozycji = new Array();
  var okres = 2 * Math.PI;
  var amplituda = 10;
  function przygotujPozycje()
  {
    x = 0;
    j = 0;
    for(i = 0; i < długośćTekstu; i++){
      tabPozycji[j++] = Math.sin(x) * amplituda + yPos;
      x += okres / długośćTekstu;
    }
  }
  function start(id, tekst, amplituda, yPos, timeout)
  {
    el = document.getElementById(id);
    if(!el) return;
    window.yPos = yPos;
    window.amplituda = amplituda;
    długośćTekstu = tekst.length;
    var str = "";
    var xPos = 10;
    for(var i = 0; i < tekst.length; i++){
      str += "<div class='litery' id='d" + i + "' ";
      str += "style='left:" + xPos + "px;top:0px;'>";
      //str += tekst[i];
      str += tekst.charAt(i);
      str += "<\/div>";
      xPos += odstęp;
    }
    el.innerHTML = str;
    przygotujPozycje();
    timerId = setInterval('zmieniaj()', timeout);
  }
  //dalsza część skryptu